<?php
namespace app\home\controller;
use think\Db;
use think\captcha\Captcha;
use think\Loader;
class Indexlist extends \think\Controller{
    public function index(){
        $reslist=db('topic')->select();
        $this->assign('reslist',$reslist);
        return $this->fetch('indexlist');//继承基类的控制器 
    }
    public function indexlist(){
        $pageno =input('post.pageno');

        $pagesize=1;
        $left=($pageno-1)*$pagesize;
        $reslist=db('topic')->alias('a')->join('user b','a.id=b.id')->field('a.*,b.nickname,b.image')->where("is_first=1")->
        limit("($left),($pagesize)")->order('id desc')->select();

        $data=array();
        foreach($result as $val){
            $img=json_decode($val['img_src'],true);
            if($img !=NULL){
                $val['img_src']=$img;
            }
        }


    }
}